﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CourseSystem.Core.Entities.StudentInfo>" %>
<%@ Import Namespace="CourseSystem.Common.Helpers" %>
<% using (Ajax.BeginForm(new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "editDiv", }))
   {%>
<% Html.RenderPartial("HighLightMsgUc"); %>
<fieldset>
    <% if (Model.Id != 0)
       { %>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.Uid) %>
    </div>
    <div class="editor-field">
        <%: Html.DisplayFor(model => model.Uid) %>
        <%: Html.ValidationMessageFor(model => model.Uid) %>
    </div>
    <% } %>
   
    <div class="editor-label">
        <%: Html.LabelFor(model => model.StuName) %>
    </div>
    <div class="editor-field">
        <%: Html.TextBoxFor(model => model.StuName) %>
        <%: Html.ValidationMessageFor(model => model.StuName) %>
    </div> <div class="editor-label">
        <%: Html.LabelFor(model => model.PassWord) %>
    </div>
    <div class="editor-field">
        <%: Html.PasswordFor(model => model.PassWord)%><% if (Model.Id != 0)
                                                          {%>不强制修改请勿填写<%}  %>
        <%: Html.ValidationMessageFor(model => model.PassWord) %>
    </div>
    <div class="editor-label">
        学院
    </div>
    <div class="editor-field">
        <%=Html.DropDownList("CollegeIdFake", StudentHelper.GetCollege(), new { onchange = "collegeChange();" })%>
        <%: Html.ValidationMessage("CollegeIdFake")%>
    </div>
    <div class="editor-label">
        系别
    </div>
    <div class="editor-field">
        <%=Html.DropDownList("DepartmentIdFake", StudentHelper.GetDepartment(Model.CollegeIdFake), new { onchange = "departChange();" })%>
        <%: Html.ValidationMessageFor(model => model.DepartmentIdFake) %>
    </div>
     <div class="editor-label">
        专业
    </div>
    <div class="editor-field">
        <%=Html.DropDownList("SubjectIdFake", StudentHelper.GetSubject(Model.DepartmentIdFake), new { onchange = "subjectChange();" })%>
        <%: Html.ValidationMessageFor(model => model.SubjectIdFake)%>
    </div>
     <div class="editor-label">
        <%: Html.LabelFor(model => model.ClassId) %>
    </div>
    <div class="editor-field">
        <%=Html.DropDownList("ClassId", StudentHelper.GetClass(Model.SubjectIdFake))%>
        <%: Html.ValidationMessageFor(model => model.ClassId)%>
    </div>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.GradeYear) %>
    </div>
    <div class="editor-field">
        <%=Html.DropDownList("GradeYear", StudentHelper.GetGradeYear())%>
        <%: Html.ValidationMessageFor(model => model.GradeYear) %>
    </div>
    <p>
        <input type="submit" value="保存" />
    </p>
</fieldset>
<% }
%>
<script type="text/javascript">
    var collegeChange = function () {
        selectLoad("DepartmentIdFake", "Ajax/GetDepart/" + $("#CollegeIdFake").val());
        if ($("#CollegeIdFake").val() == 0) {
            selectLoad("SubjectIdFake", "Ajax/GetSubject/0");
            selectLoad("ClassId", "Ajax/GetClass/0");
        }
    };
    var departChange = function () {
        selectLoad("SubjectIdFake", "Ajax/GetSubject/" + $("#DepartmentIdFake").val());
        if ($("#DepartmentIdFake").val() == 0) {
            selectLoad("ClassId", "Ajax/GetClass/0");
        }
    };
    var subjectChange = function () {
        selectLoad("ClassId", "Ajax/GetClass/" + $("#SubjectIdFake").val());
    };
    $(function () {
    });
</script>
